DIR=$( dirname "$(readlink -f  ${BASH_SOURCE[0]})" )
PARENTPATH=$(dirname ${DIR})
ROOTPATH=$(dirname ${PARENTPATH})
source ${ROOTPATH}/tools.sh
sh ${PARENTPATH}/valid_docker_images.sh memos
if [ $? != "2" ]; then
   sudo docker pull ghcr.io/usememos/memos:latest
fi
if [[ ! -d /opt/soft/docker/memos/memos ]]
then
  sudo mkdir -p /opt/soft/docker/memos/memos
fi
docker ps -a | grep memos
if [[ $? -eq 1 ]]
then
docker run -d \
  --init \
  --name memos \
  --publish 5230:5230 \
  --volume /opt/soft/docker/memos/memos/:/var/opt/memos \
  neosmemo/memos:stable
else
  docker restart memos
fi
